package permission.role;

import course.Course;

public class CourseLeaderRole implements Role {
	
	private final Course COURSE;
	
	public CourseLeaderRole(Course course) {
		COURSE = course;
	}
	
	@Override
	public RoleType getRoleType() {
		return RoleType.COURSE_LEADER;
	}
	
	public Course getCourse() {
		return COURSE;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((COURSE == null) ? 0 : COURSE.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		CourseLeaderRole other = (CourseLeaderRole) obj;
		if (COURSE == null) {
			if (other.COURSE != null) {
				return false;
			}
		} else if (!COURSE.equals(other.COURSE)) {
			return false;
		}
		return true;
	}
	
}
